package com.quanquan.user.controller;

import DTO.PageDTO;
import com.quanquan.user.dto.ConsumptionAmountDTO;
import com.quanquan.user.request.ConsumptionAmountRequestBody;
import com.quanquan.user.service.ConsumptionAmountService;
import enums.ResCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import web.response.ResultBody;

/**
 * 功能描述:
 *
 * @ClassName: ConsumptionAmountController
 * @Author: xiaoqianh丶
 * @Date: 2019-05-09 11:23
 * @Version: V1.0
 */

@RestController
@RequestMapping("/consumption_amount")
public class ConsumptionAmountController {

    private final ConsumptionAmountService consumptionAmountService;

    @Autowired
    public ConsumptionAmountController(ConsumptionAmountService consumptionAmountService) {
        this.consumptionAmountService = consumptionAmountService;
    }

    /**
     * 列表
     * @param requestBody
     * @return
     */
    @PostMapping("/list")
    @ResponseBody
    public ResultBody list (@RequestBody ConsumptionAmountRequestBody requestBody){
        PageDTO<ConsumptionAmountDTO> consumptionAmountDTOPageDTO = null;
        consumptionAmountDTOPageDTO = consumptionAmountService.list(requestBody);
        return new ResultBody(ResCodeEnum.SUCCESS.getCode(), ResCodeEnum.SUCCESS.getMsg(), consumptionAmountDTOPageDTO);
    }

}
